package com.lute.utils;

import java.util.GregorianCalendar;
import java.util.List;

import org.hibernate.HibernateException;
import org.springframework.security.oauth2.common.json.JSONException;
import org.springframework.security.oauth2.common.json.JSONObject;

import com.lute.model.Approver;
import com.lute.model.BusinessUnit;
import com.lute.model.Client;
import com.lute.model.ClientAccountingPeriod;
import com.lute.model.ClientAdmin;
import com.lute.model.ClientAdminProfile;
import com.lute.model.ClientProfile;
import com.lute.model.CompanyCategory;
import com.lute.model.Employee;
import com.lute.model.EmployeeAccountingPeriod;
import com.lute.model.EmployeeEntry;
import com.lute.model.EmployeeProfile;
import com.lute.model.NotepadEntry;
import com.lute.model.Position;
import com.lute.model.Role;
import com.lute.model.User;

public interface LuteInterfaceDAO {
	 
    public void addObjectToDataBase(Object obj);
    
    public void updateObjectinDataBase(Object obj);
    
    public void mergeObjectinDataBase(Object obj);
    
    public User getUserFromDataBase(String propertyName, String propertyValue);
    
    public User getUserFromDataBaseByUserId(String propertyName, int propertyValue);
    
    public int addNewEmployeeAndGetIdFromDataBase(Employee obj);
    
    public List<User> getUsersFromDataBase();
    
    public List<User> getUsersFromDataBase(String propertyName, String propertyValue);
    
    public List<User> getUsersByUserRoleFromDataBase(String propertyName, int propertyValue);
    
    public List<User> getUsersFromDataBase(String propertyName1,String propertyValue1,
			   							   String propertyName2,String propertyValue2);
    
    public Employee getEmployeeFromDataBase(String propertyName, String propertyValue);
    
    public Employee getEmployeeFromDataBaseById(String propertyName, int propertyValue);

    public Employee getEmployeeFromDataBaseByIdWithProfile(String propertyName, int propertyValue);

    public Employee  getEmployeeFromDataBaseByIdWithAccPeriod(String propertyName, int propertyValue);
    
    public List<Employee> getEmployeesByAccLockedFromDataBase(String propertyName, String propertyValue);
    
    public List<Employee> getEmployeesFromDataBase();

	public Employee getEmployeeFromDataBaseByIdWithAccPeriodNotepadEntries(String propertyName, int propertyValue);
    
	public Employee getEmployeeFromDataBaseByIdWithAccPeriodClientAccPeriodEmployeeEntries(String propertyName, int propertyValue);
    
	public EmployeeProfile getEmployeeProfileByEmployeeIdFromDataBase(String employeeRole, int userId);
	
	public List<EmployeeProfile> getEmployeeProfilesFromDataBase();
	
	public List<EmployeeProfile> getEmployeeProfilesByUserIdsFromDataBase(List<Integer> employeeIds);
	
	public List<EmployeeProfile> getEmployeeProfileByClientIdFromDataBase(String propertyName, int propertyValue);
	
	public List<User> getEmployeesAndApproversFromDataBase(String propertyName, String propertyValue);
    
    public List<Approver> getApproversFromDataBase();
    
    public List<Approver> getApproversByAccLockedFromDataBase(String propertyName, String propertyValue);
    
    public Approver getApproverFromDataBase(String propertyName, String propertyValue);
    
    public Approver getApproverFromDataBaseById(String propertyName, int propertyValue);
    
    public Approver getApproverFromDataBaseByIdWithAccPeriod(String propertyName, int propertyValue);
    
    public Approver getApproverFromDataBaseByIdWithEmployees(String propertyName, int propertyValue);
    
    public Approver getApproverFromDataBaseByIdWithAll(String propertyName, int propertyValue);
    
	public Approver getApproverFromDataBaseByIdWithAllApproverEntries(String propertyName, int propertyValue);
    
    public ClientAdmin getClientAdminFromDataBaseById(String propertyName, int propertyValue);

    public ClientAdmin getClientAdminFromDataBaseByIdWithClientsClientAccPeriodsEmployeeAccPeriodsEmployees(String propertyName, int propertyValue);

	public ClientAdmin getClientAdminFromDataBaseByIdWithClients(String propertyName, int propertyValue);

    public EmployeeProfile getEmployeeProfileById(String propertyName, int propertyValue);
    
	public Client getClientFromDataBase(String propertyName, String propertyValue);
	
	public List<Client> getClientsFromDataBase();
	
	public Client getClientFromDataBaseById(String propertyName, int propertyValue);
	
	public Client getClientWithAccPeriodByIdFromDataBase(String propertyName, int propertyValue);
	
	public Client getClientWithBusinessUnitsByIdFromDataBase(String propertyName, int propertyValue);
	
	public ClientAccountingPeriod getClientAccountingPeriodByIdFromDataBase(String propertyName, int propertyValue);
	
	public ClientAccountingPeriod getClientCurrentAccountingPeriodFromDataBase(String propertyName, int propertyValue) throws HibernateException;
	
	public ClientAccountingPeriod getClientAccountingPeriodWithEmployeeAccPeriodsByIdFromDataBase(String propertyName, int propertyValue);
	
	public ClientAccountingPeriod getClientAccountingPeriodWithEmployeeAccPeriodsBySpecifiedClientFromDataBase(String propertyName1, int propertyValue,
			   																								   String propertyName2, GregorianCalendar cal);
	
	public ClientProfile getClientProfileById(String propertyName, int propertyValue);
	
	public ClientProfile getClientProfileByIdWithClientsAdmin(String propertyName, int propertyValue);
	
	public List<ClientProfile> getClientProfileByIdWithClientsAdmin(String propertyName, int[] propertyValues);
	
	public ClientAdminProfile getProfileFromDataBase(String propertyName,String propertyValue);
	
	public ClientAdminProfile getClientAdminProfileByClientAdminIdFromDataBase(int propertyValue);
	
	public List<ClientAdminProfile> getClientAdminProfilesFromDataBase();
	
	public List<ClientAdminProfile> getClientAdminProfilesWithClientsFromDataBase();
	
	public ClientAdminProfile getClientAdminProfileByClientAdminIdWithClientsFromDataBase(int propertyValue);
	
	public List<ClientAdmin> getClientAdminFromDataBaseByAccLocked(String propertyName, String propertyValue);
	
	//public List<ClientAdminProfile> getClientAdminProfilesByUserIdsFromDataBase(List<Integer> clientAdminIds);
	
	public EmployeeAccountingPeriod getEmployeeAccountingPeriodFromDataBase(String propertyName, String propertyValue);
	
	public List<EmployeeAccountingPeriod> getEmployeeAccountingPeriodsWithEntriesFromDataBase(List<EmployeeAccountingPeriod> periods);
	
	public void updateEmployeeAccountingPeriodsInDataBase(List<EmployeeAccountingPeriod> periods);
	
	public EmployeeAccountingPeriod getEmployeeAccountingPeriodFromDataBaseById(String propertyName, int propertyValue);
	
	public List<EmployeeAccountingPeriod> getEmployeeAccountingPeriodsByClientIdFromDataBase(String propertyName, int propertyValue);
	
	public List<EmployeeAccountingPeriod> getEmployeeAccountingPeriodsFromDataBase(List<Integer> employeeIds, GregorianCalendar from);
	
	public Role getRoleFromDataBase(String propertyName, String propertyValue);
	
	public void changeObjectType(Approver object, int id, Class<Employee> genericType, String idColumn,
            String discriminatorColumn, String discriminatorValue);
	
	public void deleteNotepadEntriesFromEmployeeAccountingPeriod(List<NotepadEntry> notepadEntriesToDelete);
	
	public void deleteEmployeeEntriesFromEmployeeAccountingPeriod(List<EmployeeEntry> employeeEntriesToDelete);
	
	public CompanyCategory getCompanyCategoryFromDataBase(String propertyName, String propertyValue);
	
	public BusinessUnit getBusinessUnitFromDataBase(String propertyName, String propertyValue);
	
	public BusinessUnit getBusinessUnitFromDataBaseById(String propertyName, int propertyValue);
	
	public Position getPositionFromDataBase(String propertyName, String propertyValue);
	
	public Position getPositionFromDataBaseById(String propertyName, int propertyValue);
}
